Baselines

hi,
i´ve some problems in loading different baseline versions
i want to count informations by kind of types, for comparsion the baseline versions
i only get informations of the current module version
perhaps someone can help



// Count status of requirements
/************************************************************************
Counter for OPL

2010_09_01
************************************************************************/
pragma runLim,0;
// constant declarations //

const string AobjectType1 = "work_progress_sv"
const string AobjectType2 = "Status Kommentar"

// variable declarations //

Folder xF = folder "/MIB_MQB_KI/Consolidated"
int x = 0
Module m = current
string modName = "MQB_Kombi_OPL"

Date d = today()
string aus = "C:/Documents and Settings/uidt5483/Desktop/Automatismus_NEU/Status_" modName "_" d ".csv"
Stream out = write aus

out << "Status_MQB_Kombi_OPL" "\n\n"
m = share("/MIB_MQB_KI/Consolidated/MQB_Kombi_OPL",true)
Baseline b
Date datum= "01 Januar 1970"
/******************************************************************************************************/

for (x=50; x<=55; x+=1)
{
b = baseline(x,0,null)
out << "\n\n" "Baseline_" major b "_" dateOf b "\n"
//if (datum!=dateOf b)
{
level 0
datum = dateOf b

/******************************************************************************************
  • *
  • first Attribute start *
  • *
******************************************************************************************/

Object o = null
string oot = ""
int offenCount = 0
int erledigtCount = 0
int abgelehntCount = 0
int inarbeitCount = 0
int i = 0

out << "\n\n" "Status of Attribute:" ";"";" AobjectType1 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " ";" "in Arbeit " "\n"
if !exists attribute AobjectType1 then
{
print "Atribute not found"
}
level 0

// main program //
for o in m do
{
oot = o.AobjectType1
if oot == "offen" then offenCount ++ else
if oot == "erledigt" then erledigtCount ++ else
if oot == "abgelehnt" then abgelehntCount ++ else
if oot == "in Arbeit" then inarbeitCount ++
}

out << offenCount ";" erledigtCount ";" abgelehntCount ";" inarbeitCount "\n\n"
oot = ""
o = null
offenCount = 0
erledigtCount = 0
abgelehntCount = 0
inarbeitCount = 0

/******************************************************************************************
  • *
  • first Attribute end - second Attribute start *
  • *
******************************************************************************************/

o = null
oot = ""
offenCount = 0
erledigtCount = 0
abgelehntCount = 0
inarbeitCount = 0
out <<"\n" "Status of Attribute:" ";"";" AobjectType1 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " "\n"
if !exists attribute AobjectType2 then
{
print "Atribute not found"
}
level 0
// main program //
for o in m do
{
oot = o.AobjectType2
if oot == "offen" then offenCount ++ else
if oot == "erledigt" then erledigtCount ++ else
if oot == "abgelehnt" then abgelehntCount ++
}

out << offenCount ";" erledigtCount ";" abgelehntCount "\n\n\n"
oot = ""
o = null
offenCount = 0
erledigtCount = 0
abgelehntCount = 0

}
load(m,b,false)

}
close out
print "finished..."


Reudaeaeae - Mon Sep 06 08:36:21 EDT 2010

Re: Baselines
Mathias Mamsch - Mon Sep 06 09:46:28 EDT 2010

First: Please use the "{ C O D E }" statement to post code, so that the formatting does not get lost. It helps a lot, especially with larger code parts.

Just from a first reading: The variable m stays the same for the whole program. You probably wanted to do

m = load(m,b,false)

 


instead of

 

 

 

load(m,b,false)



Maybe that helps? Regards, Mathias



 

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Baselines
Reudaeaeae - Mon Sep 06 10:04:54 EDT 2010

Mathias Mamsch - Mon Sep 06 09:46:28 EDT 2010

First: Please use the "{ C O D E }" statement to post code, so that the formatting does not get lost. It helps a lot, especially with larger code parts.

Just from a first reading: The variable m stays the same for the whole program. You probably wanted to do

m = load(m,b,false)

 


instead of

 

 

 

load(m,b,false)



Maybe that helps? Regards, Mathias



 

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

thx mathias but no, it doesn´t help...
perhaps i should explain what i want to do with this script

i have a module with many baseline versions - nearly 90 exemplars.
now i want to count two attributes and export these numbers into an excel-file for getting a chart

Object o = null
                string oot = ""
                        int offenCount = 0
                        int erledigtCount = 0
                        int abgelehntCount = 0
                        int inarbeitCount = 0
 
 
                        int i = 0
 
                        out << "\n\n" "Status of Attribute:" ";"";" AobjectType1 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " ";" "in Arbeit " "\n"
      
                          
                             if !exists attribute AobjectType1 then
                             {
                             print "Atribute not found"
                             }
                                    level 0
 
    // main program //
 
                        
                              for o in m do 
                              {
                              oot = o.AobjectType1 
                              if oot == "offen" then offenCount ++ else
                              if oot == "erledigt" then erledigtCount ++ else
                              if oot == "abgelehnt" then abgelehntCount ++ else
                              if oot == "in Arbeit" then inarbeitCount ++
                              }
 
                              out << offenCount ";"  erledigtCount ";" abgelehntCount ";"  inarbeitCount "\n\n"
   
 
                            oot = ""
                            o = null
                            offenCount = 0
                            erledigtCount = 0
                            abgelehntCount = 0
                            inarbeitCount = 0
 
 
 
/******************************************************************************************
*                                                                                         *
*                           first Attribute end - second Attribute start                  *
*                                                                                         *
******************************************************************************************/
 
 
 
                        o = null
                        oot = ""
                        offenCount = 0
                        erledigtCount = 0
                        abgelehntCount = 0
                        inarbeitCount = 0
 
 
                        out <<"\n" "Status of Attribute:" ";"";" AobjectType1 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " "\n"
      
      
                              if !exists attribute AobjectType2 then
                              {
                               print "Atribute not found"
                              }
                                    level 0
 
 
      // main program //
 
 
                                for o in m do 
                                {
                                oot = o.AobjectType2 
                                if oot == "offen" then offenCount ++ else
                                if oot == "erledigt" then erledigtCount ++ else
                                if oot == "abgelehnt" then abgelehntCount ++
                                }
                        
                                out << offenCount ";"  erledigtCount ";" abgelehntCount "\n\n\n"
   
 
                            oot = ""
                            o = null
                            offenCount = 0
                            erledigtCount = 0
                            abgelehntCount = 0

 


besides i want that it counts the two attributes automaticly for the last five baseline version of the module.... i tried it like this

 

 

 

const string AobjectType1 = "work_progress_sv"
const string AobjectType2 = "Status Kommentar"
 
// variable declarations //
 
Folder xF = folder "/MIB_MQB_KI/Consolidated"
 
 
int x = 0
Module m = current
string modName = "MQB_Kombi_OPL" 
 
 Date d = today()
 
 
string aus = "C:/Documents and Settings/uidt5483/Desktop/Automatismus_NEU/Status_" modName "_" d ".csv"
Stream out = write aus
 
out << "Status_MQB_Kombi_OPL" "\n\n"
 
 
m = share("/MIB_MQB_KI/Consolidated/MQB_Kombi_OPL",true)
Baseline b
Date datum= "01 Januar 1970"
 
 
/******************************************************************************************************/
 
    for (x=50; x<=55; x+=1)
        {
                b = baseline(x,0,null)
                out << "\n\n" "Baseline_" major b "_" dateOf b "\n"
                //if (datum!=dateOf b)
                        {
                        level 0
                        datum = dateOf b
                        m = load(m,b,false)

 


perhaps someone can help?
ps: i´m sorry for my bad english

 

 

 

 

 

 

Re: Baselines
Mathias Mamsch - Mon Sep 06 10:35:42 EDT 2010

Reudaeaeae - Mon Sep 06 10:04:54 EDT 2010

thx mathias but no, it doesn´t help...
perhaps i should explain what i want to do with this script

i have a module with many baseline versions - nearly 90 exemplars.
now i want to count two attributes and export these numbers into an excel-file for getting a chart

Object o = null
                string oot = ""
                        int offenCount = 0
                        int erledigtCount = 0
                        int abgelehntCount = 0
                        int inarbeitCount = 0
 
 
                        int i = 0
 
                        out << "\n\n" "Status of Attribute:" ";"";" AobjectType1 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " ";" "in Arbeit " "\n"
      
                          
                             if !exists attribute AobjectType1 then
                             {
                             print "Atribute not found"
                             }
                                    level 0
 
    // main program //
 
                        
                              for o in m do 
                              {
                              oot = o.AobjectType1 
                              if oot == "offen" then offenCount ++ else
                              if oot == "erledigt" then erledigtCount ++ else
                              if oot == "abgelehnt" then abgelehntCount ++ else
                              if oot == "in Arbeit" then inarbeitCount ++
                              }
 
                              out << offenCount ";"  erledigtCount ";" abgelehntCount ";"  inarbeitCount "\n\n"
   
 
                            oot = ""
                            o = null
                            offenCount = 0
                            erledigtCount = 0
                            abgelehntCount = 0
                            inarbeitCount = 0
 
 
 
/******************************************************************************************
*                                                                                         *
*                           first Attribute end - second Attribute start                  *
*                                                                                         *
******************************************************************************************/
 
 
 
                        o = null
                        oot = ""
                        offenCount = 0
                        erledigtCount = 0
                        abgelehntCount = 0
                        inarbeitCount = 0
 
 
                        out <<"\n" "Status of Attribute:" ";"";" AobjectType1 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " "\n"
      
      
                              if !exists attribute AobjectType2 then
                              {
                               print "Atribute not found"
                              }
                                    level 0
 
 
      // main program //
 
 
                                for o in m do 
                                {
                                oot = o.AobjectType2 
                                if oot == "offen" then offenCount ++ else
                                if oot == "erledigt" then erledigtCount ++ else
                                if oot == "abgelehnt" then abgelehntCount ++
                                }
                        
                                out << offenCount ";"  erledigtCount ";" abgelehntCount "\n\n\n"
   
 
                            oot = ""
                            o = null
                            offenCount = 0
                            erledigtCount = 0
                            abgelehntCount = 0

 


besides i want that it counts the two attributes automaticly for the last five baseline version of the module.... i tried it like this

 

 

 

const string AobjectType1 = "work_progress_sv"
const string AobjectType2 = "Status Kommentar"
 
// variable declarations //
 
Folder xF = folder "/MIB_MQB_KI/Consolidated"
 
 
int x = 0
Module m = current
string modName = "MQB_Kombi_OPL" 
 
 Date d = today()
 
 
string aus = "C:/Documents and Settings/uidt5483/Desktop/Automatismus_NEU/Status_" modName "_" d ".csv"
Stream out = write aus
 
out << "Status_MQB_Kombi_OPL" "\n\n"
 
 
m = share("/MIB_MQB_KI/Consolidated/MQB_Kombi_OPL",true)
Baseline b
Date datum= "01 Januar 1970"
 
 
/******************************************************************************************************/
 
    for (x=50; x<=55; x+=1)
        {
                b = baseline(x,0,null)
                out << "\n\n" "Baseline_" major b "_" dateOf b "\n"
                //if (datum!=dateOf b)
                        {
                        level 0
                        datum = dateOf b
                        m = load(m,b,false)

 


perhaps someone can help?
ps: i´m sorry for my bad english

 

 

 

 

 

 

Hmm without testing your code - you can use a code skeleton like this for your evaluations:
 

void exportStatistics (Module m, Stream out) {
    print "Exporting statistics for module " (name m ) " " (versionString moduleVersion m) "\n"
    Object o 
 
    for o in m do {
        // do your counting and exporting to the stream in here ...
    }
 
}
 
// replace this by the output file ...
Stream out = null // write "C:\\temp\\file.txt"
 
// how many baselines do you want to process? 
const int LAST_BASELINES_TO_PROCESS = 5
 
// Do this for the current module. Make this any other module if you want. 
Module m = current 
 
Baseline b 
 
Skip sk = create(); 
 
int count = 0; 
 
// Put the baselines to a skip list in reverse order 
for b in m do { put (sk, --count, b) }
 
// Add the current module as the first one 
put (sk, --count, null Baseline) 
 
count = 0
 
// Process the skip list (current module comes first, then the baselines in "latest first" order
for b in sk do { 
        Module modProcessed
        // Load the baseline or use the current module ... 
        if (null b) { 
                modProcessed = m 
        } else { 
              modProcessed = load(m, b, false) 
        }    
 
        // Enter your code to create the statistics here 
        exportStatistics (modProcessed, out) 
 
        // close the baseline       
        if (modProcessed != m) close modProcessed
 
        // process only the last LAST_BASELINES_TO_PROCESS baselines
        if (++count == LAST_BASELINES_TO_PROCESS) break
}

 


Hope this helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: Baselines
Reudaeaeae - Tue Sep 07 04:41:48 EDT 2010

Mathias Mamsch - Mon Sep 06 10:35:42 EDT 2010

Hmm without testing your code - you can use a code skeleton like this for your evaluations:
 

void exportStatistics (Module m, Stream out) {
    print "Exporting statistics for module " (name m ) " " (versionString moduleVersion m) "\n"
    Object o 
 
    for o in m do {
        // do your counting and exporting to the stream in here ...
    }
 
}
 
// replace this by the output file ...
Stream out = null // write "C:\\temp\\file.txt"
 
// how many baselines do you want to process? 
const int LAST_BASELINES_TO_PROCESS = 5
 
// Do this for the current module. Make this any other module if you want. 
Module m = current 
 
Baseline b 
 
Skip sk = create(); 
 
int count = 0; 
 
// Put the baselines to a skip list in reverse order 
for b in m do { put (sk, --count, b) }
 
// Add the current module as the first one 
put (sk, --count, null Baseline) 
 
count = 0
 
// Process the skip list (current module comes first, then the baselines in "latest first" order
for b in sk do { 
        Module modProcessed
        // Load the baseline or use the current module ... 
        if (null b) { 
                modProcessed = m 
        } else { 
              modProcessed = load(m, b, false) 
        }    
 
        // Enter your code to create the statistics here 
        exportStatistics (modProcessed, out) 
 
        // close the baseline       
        if (modProcessed != m) close modProcessed
 
        // process only the last LAST_BASELINES_TO_PROCESS baselines
        if (++count == LAST_BASELINES_TO_PROCESS) break
}

 


Hope this helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

it works great...thx alot

Re: Baselines
Reudaeaeae - Tue Sep 07 04:56:56 EDT 2010

Reudaeaeae - Tue Sep 07 04:41:48 EDT 2010
it works great...thx alot

one last question...
i have ...

pragma runLim,0;
Folder xF = folder "/MIB_MQB_KI/Consolidated"
 
/****************************************************************************************************/
 
void exportStatistics (Module m, Stream out)
{
    Object o 
     string oot = ""
        int offenCount = 0
        int erledigtCount = 0
        int abgelehntCount = 0
        int inarbeitCount = 0
        int i = 0
        const string AobjectType1 = "work_progress_sv"
        const string AobjectType2 = "Status Kommentar"
        
        if(versionString moduleVersion m=="")
        {
                out << "Module_version:" ";"";" "current"
        }
        else
        {
                out << "Module Version:" ";"";" (versionString moduleVersion m)
        }
        
/************************first Attribute start*****************************************************/
 
        out << "\n\n" "Status of Attribute:" ";"";" AobjectType1 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " ";" "in Arbeit " "\n"
      
                          
        if !exists attribute AobjectType1 then
                {
                print "Atribute not found"
                }
                        level 0
                                
    for o in m do
    {
                oot = o.AobjectType1 
                if oot == "offen" then offenCount ++ else
                if oot == "erledigt" then erledigtCount ++ else
                if oot == "abgelehnt" then abgelehntCount ++ else
                if oot == "in Arbeit" then inarbeitCount ++
        }
 
        out << offenCount ";"  erledigtCount ";" abgelehntCount ";"  inarbeitCount "\n"
   
 
                oot = ""
                o = null
                offenCount = 0
                erledigtCount = 0
                abgelehntCount = 0
                inarbeitCount = 0
 
 
 
/*****************first Attribute end - second Attribute start****************************************/
 
        out <<"\n" "Status of Attribute:" ";"";" AobjectType2 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " "\n"
      
      
        if !exists attribute AobjectType2 then
                {
                print "Atribute not found"
                }
                        level 0
 
 
        for o in m do 
        {
                oot = o.AobjectType2 
                if oot == "offen" then offenCount ++ else
                if oot == "erledigt" then erledigtCount ++ else
                if oot == "abgelehnt" then abgelehntCount ++
        }
                        
        out << offenCount ";"  erledigtCount ";" abgelehntCount "\n\n\n"
   
 
                oot = ""
                o = null
                offenCount = 0
                erledigtCount = 0
                abgelehntCount = 0
 
 
}
 
/*************************************************************************************************************/
 
Date d = today()
string modname = "MQB_Kombi_OPL"
// replace this by the output file ...
Stream out = write "C:/Documents and Settings/uidt5483/Desktop/Automatismus_NEU/Status_" modname "_" d ".csv"
 
/****************************************************************************************************************/
 
// how many baselines do you want to process? 
const int LAST_BASELINES_TO_PROCESS = 5
 
// Do this for the current module. Make this any other module if you want. 
Module m = share("/MIB_MQB_KI/Consolidated/MQB_Kombi_OPL",false)
 
Baseline b 
 
Skip sk = create(); 
 
int count = 0; 
 
/********************************************************************************************************************/
 
// Put the baselines to a skip list in reverse order 
for b in m do { put (sk, --count, b) }
 
// Add the current module as the first one 
put (sk, --count, null Baseline) 
 
count = 0
 
// Process the skip list (current module comes first, then the baselines in "latest first" order
for b in sk do { 
        Module modProcessed
        // Load the baseline or use the current module ... 
        if (null b) { 
                modProcessed = m 
        } else { 
              modProcessed = load(m, b, false) 
        }    
 
        // Enter your code to create the statistics here 
        exportStatistics (modProcessed, out) 
 
        // close the baseline       
        if (modProcessed != m) close modProcessed
 
        // process only the last LAST_BASELINES_TO_PROCESS baselines
        if (++count == LAST_BASELINES_TO_PROCESS) break
        
}

 


... and now my problem is that there are many baselines with the same date an the same informations and i want only baselines with different dates, but i can´t do it with "if" and "dateOf"
i don´t know why but "dateOf" doesn´t work... anyone an idea???

 

Re: Baselines
Mathias Mamsch - Tue Sep 07 16:18:14 EDT 2010

Reudaeaeae - Tue Sep 07 04:56:56 EDT 2010

one last question...
i have ...

pragma runLim,0;
Folder xF = folder "/MIB_MQB_KI/Consolidated"
 
/****************************************************************************************************/
 
void exportStatistics (Module m, Stream out)
{
    Object o 
     string oot = ""
        int offenCount = 0
        int erledigtCount = 0
        int abgelehntCount = 0
        int inarbeitCount = 0
        int i = 0
        const string AobjectType1 = "work_progress_sv"
        const string AobjectType2 = "Status Kommentar"
        
        if(versionString moduleVersion m=="")
        {
                out << "Module_version:" ";"";" "current"
        }
        else
        {
                out << "Module Version:" ";"";" (versionString moduleVersion m)
        }
        
/************************first Attribute start*****************************************************/
 
        out << "\n\n" "Status of Attribute:" ";"";" AobjectType1 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " ";" "in Arbeit " "\n"
      
                          
        if !exists attribute AobjectType1 then
                {
                print "Atribute not found"
                }
                        level 0
                                
    for o in m do
    {
                oot = o.AobjectType1 
                if oot == "offen" then offenCount ++ else
                if oot == "erledigt" then erledigtCount ++ else
                if oot == "abgelehnt" then abgelehntCount ++ else
                if oot == "in Arbeit" then inarbeitCount ++
        }
 
        out << offenCount ";"  erledigtCount ";" abgelehntCount ";"  inarbeitCount "\n"
   
 
                oot = ""
                o = null
                offenCount = 0
                erledigtCount = 0
                abgelehntCount = 0
                inarbeitCount = 0
 
 
 
/*****************first Attribute end - second Attribute start****************************************/
 
        out <<"\n" "Status of Attribute:" ";"";" AobjectType2 "\n\n" "offen " ";" "erledigt " ";" "abgelehnt " "\n"
      
      
        if !exists attribute AobjectType2 then
                {
                print "Atribute not found"
                }
                        level 0
 
 
        for o in m do 
        {
                oot = o.AobjectType2 
                if oot == "offen" then offenCount ++ else
                if oot == "erledigt" then erledigtCount ++ else
                if oot == "abgelehnt" then abgelehntCount ++
        }
                        
        out << offenCount ";"  erledigtCount ";" abgelehntCount "\n\n\n"
   
 
                oot = ""
                o = null
                offenCount = 0
                erledigtCount = 0
                abgelehntCount = 0
 
 
}
 
/*************************************************************************************************************/
 
Date d = today()
string modname = "MQB_Kombi_OPL"
// replace this by the output file ...
Stream out = write "C:/Documents and Settings/uidt5483/Desktop/Automatismus_NEU/Status_" modname "_" d ".csv"
 
/****************************************************************************************************************/
 
// how many baselines do you want to process? 
const int LAST_BASELINES_TO_PROCESS = 5
 
// Do this for the current module. Make this any other module if you want. 
Module m = share("/MIB_MQB_KI/Consolidated/MQB_Kombi_OPL",false)
 
Baseline b 
 
Skip sk = create(); 
 
int count = 0; 
 
/********************************************************************************************************************/
 
// Put the baselines to a skip list in reverse order 
for b in m do { put (sk, --count, b) }
 
// Add the current module as the first one 
put (sk, --count, null Baseline) 
 
count = 0
 
// Process the skip list (current module comes first, then the baselines in "latest first" order
for b in sk do { 
        Module modProcessed
        // Load the baseline or use the current module ... 
        if (null b) { 
                modProcessed = m 
        } else { 
              modProcessed = load(m, b, false) 
        }    
 
        // Enter your code to create the statistics here 
        exportStatistics (modProcessed, out) 
 
        // close the baseline       
        if (modProcessed != m) close modProcessed
 
        // process only the last LAST_BASELINES_TO_PROCESS baselines
        if (++count == LAST_BASELINES_TO_PROCESS) break
        
}

 


... and now my problem is that there are many baselines with the same date an the same informations and i want only baselines with different dates, but i can´t do it with "if" and "dateOf"
i don´t know why but "dateOf" doesn´t work... anyone an idea???

 

You can try something like the below. Regards, Mathias
 

// ... lots of code ...
 
// lets store the dates of the baselines we already processed ... 
Skip processedDates = createString() 
 
for b in sk do { 
    Module modProcessed
 
    // get the date of the baseline 
    Date dateBS = dateOf b
    string strDateBS = dateBS "" 
    
    // if we already had a baseline with that date, continue    
    if (find(processedDates, strDateBS)) continue
    
    // continue and store the date as an already processed date
    put(processedDates, strDateBS, 0)
    // ... more code ...

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS